package com.server.questionbank.snframe.util.FileUtil.policy.impl;


import com.server.questionbank.snframe.util.FileUtil.policy.PolicyType;
import com.server.questionbank.snframe.util.FileUtil.policy.AbstractPolicy;

/**
 * 只读策略实现
 */
public class ReadOnlyPolicy extends AbstractPolicy {
    
    @Override
    protected String doBuildPolicy(String bucketName) {
        return String.format("""
            {
                "Version": "2012-10-17",
                "Statement": [
                    {
                        "Effect": "Allow",
                        "Principal": {"AWS": "*"},
                        "Action": ["s3:GetObject"],
                        "Resource": "arn:aws:s3:::%s/*"
                    }
                ]
            }""", bucketName);
    }
    
    @Override
    public PolicyType getPolicyType() {
        return PolicyType.READ_ONLY;
    }
} 